// pages/account/extract/extract.js
Page({
  data: {
    amount: 100.00,
    price: 0.00,
    priceTx: '0.00',
    isValid: 0,
  },
  onLoad: function (options) {
    // 页面初始化 options为页面跳转所带来的参数
  },
  inputPrice(e) {
    var inputPrice =  parseFloat(e.detail.value);
    var tempPrice = this.data.amount - inputPrice;
    this.setData({
      price: tempPrice,
      priceTx: tempPrice.toFixed(2),
    });
    
    if (inputPrice) {
      if (parseFloat(e.detail.value) <= this.data.amount) {
        this.setData({ isValid: 1 });
      } else {
        this.setData({ isValid: 0 });
      }
    } else {
      this.setData({
        isValid: 0,
        price: 0,
        priceTx: this.data.amount.toFixed(2),
      });
    }
  },
  ok(){
    if(this.data.isValid){
      wx.showToast({
        title:'提现申请成功'
      });
    }
  },
  onReady: function () {
    // 页面渲染完成
  },
  onShow: function () {
    // 页面显示
  },
  onHide: function () {
    // 页面隐藏
  },
  onUnload: function () {
    // 页面关闭
  }
})